import { createRouter, createWebHistory } from 'vue-router'

import Index from '@/views/index.vue'
import Home from '@/views/home.vue'
import Cal from '@/views/cal.vue'
import Cart from '@/views/cart.vue'
import My from '@/views/my.vue'
import Login from '@/views/login.vue'
import Register from '@/views/register.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
              { path: '/', redirect:'/register',},
        
    { path: '/index', name: 'index', component: Index, children:[

          { path: 'home', name: 'home', component: Home,},
          { path: 'cal', name: 'cal', component: Cal,},
          { path: 'cart', name: 'cart', component: Cart,},
          { path: 'my', name: 'my', component: My,},
    ]},
            { path: '/login', name: 'login', component: Login,},
            { path: '/register', name: 'register', component: Register,},
  ],
})

export default router
